<template>
<div>
  <h1>修改学生</h1>
  <p>修改姓名<input type="text" v-model="form.name"></p>
  <p>修改年龄<input type="text" v-model="form.age"></p>
  <button @click="put">修改</button>
</div>
</template>

<script>
export default {
  name: "put_stu",
  data(){
    return{
      id : this.$route.query.id,
      form:{}
    }
  },
  methods:{
    put(){
      this.$axios.put('http://127.0.0.1:5000/stu?id='+this.id+'&name='+this.form.name+'&age='+this.form.age).then(i=>{
        if (i.data.code ==200 ){
          alert('修改成功')
          this.$router.push('add_all/')
        }
      })
    }
  },
  mounted() {
  }
}
</script>

<style scoped>

</style>
